/************************************************************
* @file gkt_adc.h
************************************************************/

#ifndef GKT_ADC_H
#define GKT_ADC_H

#include "gkt_list.h"
#include "gkt_board.h"
#include "gkt_debug.h"
#include "g_adc.h"

#define ADC_CHANNEL_L2(channel_name)	\
		ADC_GPIO_##channel_name
#define ADC_CHANNEL_L1(channel_name)	\
		ADC_CHANNEL_L2(channel_name)
#define ADC_USED_CHANNEL	\
		ADC_CHANNEL_L1(GKT_CONFIG_ADC_CHANNEL)


#define ADC_CONVERSION_TIMES_MAX  17		//CONVERSION MAX
#define	ADC_CONVERSION_TIMEOUT	30		//US  MAX~20
#define	ADC_VALUE_RANGE	2400

typedef enum{
	ADC_RES_12	=	0,
	ADC_RES_10	=	1,
	ADC_RES_8	=	2,
	ADC_RES_6	=	3,
	ADC_RES_MAX,
}adc_res_e;

typedef struct _gkt_adc_attr {
	uint32_t channel;
	uint32_t scale_type;/*700MV:3 1200MV:2 2400:3MV*/
	uint32_t mode;
} gkt_adc_attr_s;

int gkt_adc_init(void);
int gkt_adc_config(uint8_t dev_id,gkt_adc_attr_s *adc_attr);
int gkt_adc_start(uint8_t dev_id, int *adc_value);
int gkt_adc_standby(void);

#endif

